#pragma once

#include "TestActiveObject.h"

namespace CO { namespace SpiFoundation { namespace RoomFW {

//
// Test adding additional wait event to an active object.
//
class ExtraEventAO;
typedef ::boost::shared_ptr<ExtraEventAO> ExtraEventAOSP;
class ExtraEventAO : public TestActiveObject
{
public:

	virtual bool initialize(SpiFoundation::Configuration::ConfigKey& configRoot);

	SimpleEvent testEvent_;

protected:

	virtual void handle(RoomMessageSP message);
	virtual size_t waitHandleSize();
	virtual void getWaitHandles(HandleArray& handles);
	virtual void handleEvent(HANDLE eventHandle);
};

class ExtraAoEventsTestSuite : public Test::Suite
{
public:
	ExtraAoEventsTestSuite();
	~ExtraAoEventsTestSuite();

protected:
	virtual void setup();
	virtual void tear_down();

private:
	static const DWORD DWait = 2000; // Default to 2 second wait for anything.

	//
	// Portal message handler methods.
	//
	bool handlePort1(CO::SpiFoundation::RoomFW::RoomMessageSP message);

	//
	// Main test method.
	//
	void Main();

	//
	// Initialization flag and error message because TEST_ASSERT only useful
	//	in test case methods added by TEST_ADD.
	//
	bool initialized_;
	std::string errorMessage_;

	//
	// Test complete flag.
	//
	bool testComplete_;

	//
	// Additional test variables.
	//
	size_t responseCount_;
	static const size_t messageCount_ = 10000;

	//
	// Object to test.
	//
	ExtraEventAOSP activeObject_;

	//
	// Portals and Messaging.
	//
	CO::SpiFoundation::RoomFW::PortalQueue portalQueue_;
	CO::SpiFoundation::RoomFW::CallbackPortalSP activeObjectPortal_;
	CO::SpiFoundation::RoomFW::BindingList bindingList_;
};

}}}
